

	<!-- 当前所在位置 START -->
	{include file="_url.here.tpl"}
	<!-- 当前所在位置 END -->

	<!-- 主体区 -->
	<div class="area">

		<!-- 主体左边区 START -->
		<div class="aleft">
			
			<!-- 左边导航栏 START -->
			{include file='./user/_user.nav.tpl'}
			<!-- 左边导航栏 END -->
			
		</div>
		<!-- 主体左边区 END -->

		<!-- 主体右边区 START -->
		<div class="aright">

			<!-- 头像上传 START -->
			<div class="avatar_box">
			{if $_sysvars.ucenter_bridge.using == 1}
			<input type="button" value="去社区中心修改头像" class="button" onclick="window.open('{$_sysvars.ucenter_bridge.discuz}home.php?mod=spacecp&ac=avatar');" />
			{else}
				<form id="fm_avatar" action="./index.php?frm=user&mdl=avatar&do=save" method="post" target="ajax" enctype="multipart/form-data">
					<input type="hidden" name="avatar_old" id="avatar_old" value="{$userinfo.avatar}" />
					<b class="file">＋选择图片<input type="file" name="file_avatar" id="file_avatar" class="input" /></b>
				</form>
			{/if}
			</div>
			<!-- 头像上传 END -->

			<form id="fm_userinfo" action="./index.php?frm=user&mdl=user&do=info" method="post" target="ajax">

				<!-- 帐户信息 START -->
				<div class="sl_t_block bdcolor-olivine">
					<div class="tt">
						<em><!-- <a href="http://e.cn/discuzX/home.php?mod=spacecp&ac=avatar" target="_blank">修改头像</a> --></em><h2 class="color-olivine">帐户信息</h2>
					</div>
					<div class="main-block pattern_line_right key-item">

						{if $_sysvars.ucenter_bridge.using == 1}
						<div class="pop">
							<!-- <iframe src="http://e.cn/discuzX/home.php?mod=spacecp&ac=avatar&single=1" frameborder="0" style="width:450px; height:345px;"></iframe> -->
							{$uc_avatar_edit}
						</div>
						{else}
						<!-- 头像 START -->
						<div class="pop">
							<input type="hidden" name="avatar" id="avatar" value="{$userinfo.avatar}" />
							<!-- 剪裁坐标和大小 START -->
							<input type="hidden" id="cropX" name="cropX" value="0" />
							<input type="hidden" id="cropY" name="cropY" value="0" />
							<input type="hidden" id="cropW" name="cropW" value="0" />
							<input type="hidden" id="cropH" name="cropH" value="0" />
							<!-- 剪裁坐标和大小 END -->
							<div id="avatar_preview" class="avatar_preview hide"><div class="box"></div></div>
							<div id="img_avatar" {if $userinfo.thumb == ''}class="hide"{/if}><img src="{if $userinfo.thumb != ''}{$_s.up_dir}{$userinfo.thumb}{/if}" /></div>
						</div>
						<!-- 头像 END -->
						{/if}

						<dl><dt>用户名：</dt><dd>{$userinfo.username}</dd>
							<div class="clear"></div></dl>
						<dl><dt>昵称：</dt><dd><input type="text" tabindex="1" name="nickname" value="{$userinfo.nickname}" class="input" style="width:240px;" /></dd>
							<div class="clear"></div></dl>
						<dl><dt>真实姓名：</dt><dd><input type="text" tabindex="2" name="realname" value="{$userinfo.realname}" class="input" style="width:240px;" /></dd>
							<div class="clear"></div></dl>
						<dl><dt>性别：</dt><dd>
							<input type="radio" tabindex="3" name="sex" value="1"{if $userinfo.sex eq 1}checked{/if} />男
							<input type="radio" tabindex="4" name="sex" value="2"{if $userinfo.sex eq 2}checked{/if} />女
							<input type="radio" tabindex="5" name="sex" value="0"{if $userinfo.sex eq 0}checked{/if} />保密
							</dd><div class="clear"></div></dl>
						<dl><dt>邮箱：</dt><dd><input type="text" tabindex="6" name="email" value="{$userinfo.email}" class="input" style="width:360px;" /></dd>
							<div class="clear"></div></dl>
						<dl><dt><a name="mobile">&nbsp;</a>手机：</dt><dd><input type="text" tabindex="7" name="mobile" value="{$userinfo.mobile}" class="input" style="width:240px;" /></dd>
							<div class="clear"></div></dl>
						<dl><dt>身份证：</dt><dd><input type="text" tabindex="8" name="hkid" value="{$userinfo.hkid}" class="input" style="width:240px;" /></dd>
							<div class="clear"></div></dl>
						<dl><dt>所在地：</dt><dd>{include file='lbi/address.unity.tpl'}</dd>
							<div class="clear"></div></dl>
						<dl><dt>&nbsp;</dt><dd><input type="text" tabindex="9" name="address" value="{$userinfo.address}" class="input" style="width:480px;" /></dd>
							<div class="clear"></div></dl>

					</div>
				</div>
				<!-- 帐户信息 END -->

				<div class="space20"></div>

				<!-- 选填信息 START -->
				<div class="secondary_tag_block">
					<div class="cmtab"><a class="first cur">选填信息</a></div>
					
					<div class="main-block pattern_line_right  key-item">
						<dl><dt>生日：</dt><dd><input type="text" tabindex="10" name="birthday" id="birthday" value="{$userinfo.birthday}" class="input" style="width:100px;" /></dd><div class="clear"></div></dl>
						<dl><dt>婚姻状况：</dt><dd>
							<input type="radio" tabindex="11" name="merry" value="1"{if $userinfo.merry eq 1}checked{/if} />已婚
							<input type="radio" tabindex="12" name="merry" value="2"{if $userinfo.merry eq 2}checked{/if} />未婚
							<input type="radio" tabindex="13" name="merry" value="0"{if $userinfo.merry eq 0}checked{/if} />保密
							</dd><div class="clear"></div></dl>
						<dl><dt>月收入：</dt><dd><select tabindex="14" name="income" class="select" style="width:200px;">{$userinfo.income_options}</select></dd>
							<div class="clear"></div></dl>
						<dl><dt>兴趣爱好：</dt><dd><textarea tabindex="15" name="hobby" cols="80" rows="4" class="text">{$userinfo.hobby}</textarea></dd>
							<div class="clear"></div></dl>
						<dl><dt>个人简介：</dt><dd><textarea tabindex="16" name="intro" cols="80" rows="8" class="text">{$userinfo.intro}</textarea></dd>
							<div class="clear"></div></dl>
						
						<div class="clear"></div>

					</div>

				</div>
				<!-- 选填信息 END -->

				<div class="space20"></div>

				<div class="tcenter">
					<input type="submit" name="formAction" tabindex="17" value="提交" class="btn-main" />
				</div>

			</form>

		</div>
		<!-- 主体右边区 END -->

	</div>

	<link type="text/css" rel="stylesheet" href="{$_s.js_dir}jQuery/jquery.Jcrop.min.css" />
	<link type="text/css" rel="stylesheet" href="{$_s.js_dir}jQuery/jquery.minidpicker.css" />

	<script type="text/javascript" src="{$_s.js_dir}jQuery/jquery.Jcrop.min.js"></script>
	<script type="text/javascript" src="{$_s.js_dir}jQuery/jquery.minidpicker.js"></script>
	<script type="text/javascript" language="JavaScript" charset="utf-8">
	<!-- 
		{literal}
		var jcrop_api, $pcnt, $pimg, box_width, box_height, bounds;

		jQuery(function($){

			// 头像上传
			$('#file_avatar').change(function(){
				$(this).parents('form').trigger('submit');
			});

			jcrop_setSelect();
			
			$("#birthday").minipicker({
				showOn			: "click"
				,hideOn			: "click"
				,left			: 0
				,top			: 0
				,split			: "-"
				,timeOn			: false
				,weekOn			: false
				,beginYear		: 1949
				,endYear		: 2018
				,keepLive		: false
			});

			$('#fm_userinfo').submit(function(evt){
				var nickname	= $.trim($(this).find('input[name="nickname"]').val());
				var realname	= $.trim($(this).find('input[name="realname"]').val());
				var sex			= parseInt($(this).find('input[name="sex"]').val());
				var email		= $.trim($(this).find('input[name="email"]').val());
				var mobile		= $.trim($(this).find('input[name="mobile"]').val());
				var hkid		= $.trim($(this).find('input[name="hkid"]').val());
				
				var province_id	= parseInt($(this).find('select[name="province_id"]').val());
				var city_id		= parseInt($(this).find('select[name="city_id"]').val());
				var area_id		= parseInt($(this).find('select[name="area_id"]').val());
				var address		= $.trim($(this).find('input[name="address"]').val());
				
				var birthday	= $.trim($(this).find('input[name="birthday"]').val());
				var merry		= parseInt($(this).find('input[name="merry"]').val());
				var income		= $.trim($(this).find('input[name="income"]').val());

				var errmsg = [];
				if(nickname == '' || nickname.length < 2)errmsg.push('未输入昵称或少于两个字');
				if(realname == '' || realname.length < 2 || (new RegExp(regexEnum.chinese)).test(realname) == false)errmsg.push('未输入真实姓名或格式不正确');
				if(email == '' || email.length < 5 || (new RegExp(regexEnum.email)).test(email) == false)errmsg.push('未输入邮箱或格式不正确');
				if(mobile == '' || mobile.length < 11 || (new RegExp(regexEnum.mobile)).test(mobile) == false)errmsg.push('未输入手机或格式不正确');
				if(hkid == '' || hkid.length < 15){
					errmsg.push('未输入身份证或格式不正确');
				}else{
					var iscard = isCardID(hkid);
					if(iscard !== true){
						errmsg.push(iscard);
					}
				}

				// if(province_id == NaN || province_id <= 0)errmsg.push('未选择省');
				// if(city_id == NaN || city_id <= 0)errmsg.push('未选择市');
				// if(area_id == NaN || area_id <= 0)errmsg.push('未选择区');
				// if(address == '' || address.length < 5)errmsg.push('未输入所在地或地址不明确');

				if(birthday != '' && (new RegExp(regexEnum.date)).test(birthday) == false)errmsg.push('生日不正确');

				if(errmsg.length > 0){
					evt.iscancelled = true;	// 阻止其他事件
					errmsg = errmsg.join('<br />');
					showmsg_warning(errmsg, {title:'表单验证失败'});
					return false;
				}
				return true;
			});
		});

		function callback_userinfo_save(params){
			params.msg = params.result == 'succ' ? '账户信息保存成功' : params.msg;
			callback_common(params);
		}

		function callback_avatar_save(params){
			if(params.result == 'succ'){
				$('#avatar').val(params.msg);
				$('#avatar_old').val(params.msg);
				$('#img_avatar').html('<img src="'+_s.up_dir+params.msg+'" />').show();
				//$('#avatar_preview').find('div.box').html('<img src="'+_s.up_dir+params.msg+'" />');
			
				//setTimeout(function(){jcrop_setSelect();}, 200);
				params.onClosed = jcrop_setSelect;
				params.msg = '头像上传成功，您可以进行适当剪裁！';
			}else{
				params.msg = '头像上传失败';
			}
			callback_common(params);
		}

		function jcrop_setSelect(){
			// 判断是否需要剪裁
			$avatar_img = $('#img_avatar img');
			if($avatar_img.width() <= 200 && $avatar_img.height() <= 150){
				return true;
			}
			$('#avatar_preview').show().find('div.box').html('<img src="'+($avatar_img.attr('src'))+'" />');

			$pcnt = $('#avatar_preview .box');
			$pimg = $('#avatar_preview .box img');
			box_width = $pcnt.width();
			box_height = $pcnt.height();

			$('#img_avatar img').Jcrop({
				aspectRatio		: box_width / box_height
				,minSize		: [ 200, 150 ]
				//,maxSize		: [ 400, 300 ]
				,bgColor		: '#000'
				,bgOpacity		: 0.6
				,allowSelect	: false
				,onChange		: jcrop_update
				,onSelect		: jcrop_update
			}, function(){
				// 获取实际大小
				var bounds = this.getBounds();
				boundx = bounds[0];
				boundy = bounds[1];
				// 
				jcrop_api = this;
				jcrop_api.animateTo([0,0,200,150]);
			});
		}

		function jcrop_update(c){
			$('#cropX').val(c.x);
			$('#cropY').val(c.y);
			$('#cropW').val(c.w);
			$('#cropH').val(c.h);
			// 更新预览
			if (parseInt(c.w) > 0){
				var rx = box_width / c.w;
				var ry = box_height / c.h;

				$pimg.css({
					width: Math.round(rx * boundx) + 'px',
					height: Math.round(ry * boundy) + 'px',
					marginLeft: '-' + Math.round(rx * c.x) + 'px',
					marginTop: '-' + Math.round(ry * c.y) + 'px'
				});
			}

		}

		{/literal}
	//-->
	</script>